package com.cwiyc.orderonlineback.mapper;

import com.cwiyc.orderonlineback.entity.Shop;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ShopMapper {
    @Select("select * from shop where ssixcode=#{sixcode}")
    Shop getshop(String sixcode);

    @Update("update shop set spicture=#{spicture} where sowner=#{sowner}")
    int updatespic(String sowner, String spicture);

    @Update("update shop set screatetime=#{screatetime},sintroduction=#{sintroduction},sname=#{sname},sstatus=#{sstatus} where sowner=#{sowner}")
    int updatesinfo(String sowner, String screatetime, String sintroduction, String sname, Integer sstatus);

    @Select("select * from shop where sowner=#{sowner}")
    Shop afterupsinfo(String sowner);

    @Select("select ssixcode from shop where suid=#{suid}")
    String getcodebyuid(Integer suid);

    @Select("select sid from shop where suid=#{uid}")
    int getsidbyuid(Integer uid);

    @Insert("insert into shop (sname,screatetime,spicture,sintroduction,suid,sstatus,ssixcode,sowner) values (#{sname},#{screatetime},#{spicture},#{sintroduction},#{suid},#{sstatus},#{ssixcode},#{sowner})")
    int applyshop(String sname, String screatetime, String spicture, String sintroduction, Integer suid, Integer sstatus, String ssixcode, String sowner);

    @Select("select * from shop")
    List<Shop> getallshop();
}
